package learn_bouncycastle.security;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class SecURL {
	public static void main(String[] args) throws UnsupportedEncodingException {
		String url = "http://www.jd.com/productName=小米手机&categoryId=5 ";

		String encodeURL = URLEncoder.encode(url, "utf8");
		// http%3A%2F%2Fwww.jd.com%2FproductName%3D%E5%B0%8F%E7%B1%B3%E6%89%8B%E6%9C%BA%26categoryId%3D5+
		// 空格 +
		System.out.println(encodeURL);

		String decodeURL = URLDecoder.decode(encodeURL, "utf8");
		System.out.println(decodeURL);
	}

}
